<?php 

function viewJson($result){
    header('Content-Type: application/json');
    header('Access-Control-Allow-Origin:*'); //允许所有资源跨域
    header('Access-Control-Allow-Headers:*');//允许通过的响应报头
    header('Access-Control-Allow-Methods:*');//允许的请求方法
    header('Access-Control-Expose-Headers:*');//允许axios获取响应头中的Authorization
    header('Allow:*');//允许的请求方法
    header('Access-Control-Allow-Credentials', 'true');//运行客户端携带证书式访问
    echo  json_encode($result);
    exit();
 }